#include "doc/index_document.h"

namespace hawking {
namespace indexlib {

void IndexDocument::CreateField(int32_t field_id, uint64_t token) {
    if (field_id == -1) {
        return;
    }

    if (fields_termkeys_.size() < field_id + 1) {
        fields_termkeys_.resize(field_id + 1);
    }
    fields_termkeys_[field_id] = token;
}

bool IndexDocument::GetField(int32_t field_id, uint64_t* token) {
    if (field_id >= fields_termkeys_.size()) {
        return false;
    }

    *token = fields_termkeys_[field_id];
    return true;
}

}
}